<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" 
           uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
 <script type="text/javascript" src="js/shouye.js"></script>
</head>
<body>
	 
	<div class="panel datagrid" style="width: 517px;">
		<div class="panel-header" style="width: 505px;">
			<div class="panel-title">设备在线统计</div>
			<div class="panel-tool"></div>
		</div>
		<div class="datagrid-wrap panel-body" title=""
			style="width: 515px; height: 266px;">
			<div class="datagrid-view" style="width: 515px; height: 266px;">
				<style type="text/css">
div.datagrid-cell-c1-AreaName {
	width: 42px;
}

div.datagrid-cell-c1-AreaPollSourceCount {
	width: undefinedpx;
}

div.datagrid-cell-c1-AreaComCount {
	width: undefinedpx;
}

div.datagrid-cell-c1-AreaComOnline {
	width: undefinedpx;
}

div.datagrid-cell-c1-AreaComOffLine {
	width: undefinedpx;
}

div.datagrid-cell-c1-AreaComOnlineRate {
	width: undefinedpx;
}
</style>
				<div class="datagrid-view1" style="width: 26px;">
					<div class="datagrid-header" style="width: 26px; height: 24px;">
						<div class="datagrid-header-inner" style="display: block;">
							<table class="datagrid-htable" border="0" cellspacing="0"
								cellpadding="0" style="height: 25px;">
								<tbody>
									<tr class="datagrid-header-row">
										<td rowspan="0">
											<div class="datagrid-header-rownumber"></div>

										</td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
					<div class="datagrid-body"
						style="width: 26px; margin-top: 0px; height: 215px;">
						<div class="datagrid-body-inner">
							<table class="datagrid-btable" cellspacing="0" cellpadding="0"
								border="0" style="table-layout: auto;">
								<tbody>
									<c:forEach items="${list}" var="num" varStatus="index">
										<%-- 	<c:set var="ca" value="${ala.company_name}"/> --%>
											<c:set var="count" value="0"/>
											<c:forEach items="${list}" var="nu">
												<c:if test="${dec.area==ca}">
												<c:set var="count" value="${count+1}"/>
												</c:if>
										</c:forEach>
									<tr id="datagrid-row-r1-1-0" datagrid-row-index="0"
										class="datagrid-row" style="height: 25px;">
										<td class="datagrid-td-rownumber">
											<div class="datagrid-cell-rownumber">${index.count}</div>
										</td>
									</tr>
									</c:forEach>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
					<div class="datagrid-footer" style="width: 26px;">
						<div class="datagrid-footer-inner" style="display: block;">
							<table class="datagrid-ftable" cellspacing="0" cellpadding="0"
								border="0" style="table-layout: auto;">
								<tbody>
									<tr class="datagrid-row" datagrid-row-index="0"
										style="height: 25px;">
										<td class="datagrid-td-rownumber">
											<div class="datagrid-cell-rownumber"
												style="visibility: hidden;">1</div>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
				</div>
				<div class="datagrid-view2" style="width: 489px;">
					<div class="datagrid-header" style="width: 489px; height: 24px;">
						<div class="datagrid-header-inner" style="display: block;">
							<table class="datagrid-htable" border="0" cellspacing="0"
								cellpadding="0" style="height: 25px id="num";">
								<tbody>
									<tr class="datagrid-header-row">
										<td field="AreaName" class="">
											<div class="datagrid-cell"
												style="width: 217px; text-align: center;">
												<span>区县</span> <span class="datagrid-sort-icon">&nbsp;</span>
											</div>
										</td>
										<td field="AreaPollSourceCount" class="">
											<div class="datagrid-cell"
												style="text-align: center; width: 40px;">
												<span>企业数</span> <span class="datagrid-sort-icon">&nbsp;</span>
											</div>
										</td>
										<td field="AreaComCount" class="">
											<div class="datagrid-cell"
												style="text-align: center; width: 40px;">
												<span>监控数</span> <span class="datagrid-sort-icon">&nbsp;</span>
											</div>
										</td>
										<td field="AreaComOnline">
											<div class="datagrid-cell"
												style="text-align: center; width: 40px;">
												<span>在线数</span> <span class="datagrid-sort-icon">&nbsp;</span>
											</div>
										</td>
										<td field="AreaComOffLine">
											<div class="datagrid-cell"
												style="text-align: center; width: 40px;">
												<span>离线数</span> <span class="datagrid-sort-icon">&nbsp;</span>
											</div>
										</td>
										<td field="AreaComOnlineRate">
											<div class="datagrid-cell"
												style="text-align: center; width: 40px;">
												<span>在线率</span> <span class="datagrid-sort-icon">&nbsp;</span>
											</div>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
					<div class="datagrid-body"
						style="width: 489px; margin-top: 0px; height: 215px;">
						<table class="datagrid-btable" id="num"  cellspacing="0" cellpadding="0"
							border="0" style="table-layout: auto;">
							<tbody>
								<c:forEach items="${list}" var="onl">
								 		<c:set var="aa" value="${onl.monitor_num}"></c:set>
									    <c:set var="bb" value="${onl.online_num}"></c:set>
									    <c:set var="cc" value="${bb/aa}"></c:set>
									<tr id="datagrid-row-r1-2-0" datagrid-row-index="0"
										class="datagrid-row" style="height: 25px;">
										<td field="AreaName"><div
												style="text-align:center;height:auto;width: 218px;"
												class="datagrid-cell datagrid-cell-c1-AreaName">${onl.area}</div></td>
										<td field="AreaPollSourceCount"><div
												style="text-align:center;height:auto;width: 40px;"
												class="datagrid-cell datagrid-cell-c1-AreaPollSourceCount">${onl.company_num}</div></td>
										<td field="AreaComCount"><div
												style="text-align:center;height:auto;width: 40px;"
												class="datagrid-cell datagrid-cell-c1-AreaComCount">${onl.monitor_num}</div></td>
										<td field="AreaComOnline"><div
												style="text-align:center;height:auto;width: 40px;"
												class="datagrid-cell datagrid-cell-c1-AreaComOnline">${onl.online_num}</div></td>
										<td field="AreaComOffLine"><div
												style="text-align:center;height:auto;width: 40px;"
												class="datagrid-cell datagrid-cell-c1-AreaComOffLine">${onl.offline_num}</div></td>
										<td field="AreaComOnlineRate"><div
												style="text-align:center;height:auto;width: 40px;"
												class="datagrid-cell datagrid-cell-c1-AreaComOnlineRate"><fmt:formatNumber type="percent" 
            maxIntegerDigits="3" value="${cc}" /></div></td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
					</div>
				
					<div class="datagrid-footer" style="width: 489px;">
						<div class="datagrid-footer-inner" style="display: block;">
							<table class="datagrid-ftable" cellspacing="0" cellpadding="0"
								border="0" style="table-layout: auto;">
								<tbody>
									<c:forEach items="${list}" var="onl">
									  <c:set var="sum1" value="0"></c:set>
									  <c:set var="sum2" value="0"></c:set>
									  <c:set var="sum3" value="0"></c:set>
									  <c:set var="sum4" value="0"></c:set>
									    <c:forEach items="${list}" var="vvv">
									     	<c:set var="sum1" value="${sum1+vvv.company_num}"></c:set>
									     	<c:set var="sum2" value="${sum2+vvv.monitor_num}"></c:set>
									     	<c:set var="sum3" value="${sum3+vvv.online_num}"></c:set>
									     	<c:set var="sum4" value="${sum4+vvv.offline_num}"></c:set>
										</c:forEach>
											
										<tr id="datagrid-row-r1-2-0" datagrid-row-index="0"
											class="datagrid-row" style="height: 25px;">
											<c:set var="a" value="${sum3}"></c:set>
									  		<c:set var="b" value="${sum2}"></c:set>
									  		<c:set var="c" value="${a/b}"></c:set>
										<td field="AreaName">
											<div style="text-align:center;height:auto;width: 218px;"
												class="datagrid-cell datagrid-cell-c1-AreaName" id="bbb">合计:</div>
										</td>
										<td field="AreaPollSourceCount">
											<div style="text-align:center;height:auto;width: 40px;"
												class="datagrid-cell datagrid-cell-c1-AreaPollSourceCount">${sum1}</div>
										</td>
										<td field="AreaComCount"><div
												style="text-align:center;height:auto;width: 40px;"
												class="datagrid-cell datagrid-cell-c1-AreaComCount">${sum2}</div></td>
										<td field="AreaComOnline"><div
												style="text-align:center;height:auto;width: 40px;"
												class="datagrid-cell datagrid-cell-c1-AreaComOnline">${sum3}</div></td>
										<td field="AreaComOffLine"><div
												style="text-align:center;height:auto;width: 40px;"
												class="datagrid-cell datagrid-cell-c1-AreaComOffLine" id="aaa">${sum4}</div></td>
										<td field="AreaComOnlineRate"><div
												style="text-align:center;height:auto;width: 40px;"
												class="datagrid-cell datagrid-cell-c1-AreaComOnlineRate">
												<fmt:formatNumber type="percent" 
            maxIntegerDigits="3" value="${c}" /></div></td>
									</tr>
									</c:forEach>
								</tbody>
							</table>
						</div>
					</div>
				</div>
				<div id="DivInfo" style="display: none;"></div>
			</div>
		</div>
	</div>
</body>
</html>
